
from django_filters.rest_framework import FilterSet
from django_filters.filters import *

from apps.cbsp.models import *


class Cbsp_Bi_RecordsFilter(FilterSet):
    """
    基本信息管理过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')

    class Meta:
        model = Cbsp_Bi_Records
        fields = ['company', 'is_effective','next_checker','updater','employment_line','job_title','job_level','add_time_begin','add_time_end']


class Cbsp_Bi_Records_PersonnelFilter(FilterSet):
    """
    人员基础信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Personnel
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_ContactFilter(FilterSet):
    """
    联系信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Contact
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_Commercial_InsuranceFilter(FilterSet):
    """
    联系信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Commercial_Insurance
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_Party_GroupFilter(FilterSet):
    """
    联系信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Party_Group
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_SkillFilter(FilterSet):
    """
    联系信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Skill
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_Personal_FinanceFilter(FilterSet):
    """
    联系信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Personal_Finance
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_EducationFilter(FilterSet):
    """
    学历信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Education
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_WorkFilter(FilterSet):
    """
    工作信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Work
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']


class Cbsp_Bi_Records_CertificateFilter(FilterSet):
    """
    证书信息过滤
    """
    add_time_begin = DateFilter(field_name='create_time', lookup_expr='gte', label='开始日期')
    add_time_end = DateFilter(field_name='create_time', lookup_expr='lt', label='结束日期')
    company = CharFilter(field_name='cbsp_bi__company', lookup_expr='exact', label='公司')
    class Meta:
        model = Cbsp_Bi_Records_Certificate
        fields = ['company','is_effective','next_checker','updater','add_time_begin','add_time_end']
